﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RCSP.Common.Configurations
{
    public class EntityMapping
    {
        /// <summary>
        /// Creates new instance od entity mapping
        /// </summary>
        /// <param name="entityType">Type of entity</param>
        /// <param name="sharepointListName"></param>
        /// <param name="mappings"></param>
        public EntityMapping(Type entityType, string tableName, IDictionary<string, PropertyMapping> mappings)
        {
            TableName = tableName;
            PropertiesMapping = new Dictionary<string, PropertyMapping>(mappings);
        }

        /// <summary>
        /// Creates new instance od entity mapping
        /// </summary>
        /// <param name="entityType">Type of entity</param>
        /// <param name="sharepointListName"></param>
        /// <param name="mappings"></param>
        /// <param name="siteUrl">Site url</param>
        /// <param name="webName">Web name</param>
        public EntityMapping(Type entityType, string tableName, IDictionary<string, PropertyMapping> mappings, string connectStr)
        {
            TableName = tableName;
            ConnectionString = connectStr;
            PropertiesMapping = new Dictionary<string, PropertyMapping>(mappings);
        }

        /// <summary>
        /// Type of entity
        /// </summary>
        public Type EntityType { get; private set; }

        /// <summary>
        /// SP list name
        /// </summary>
        public string TableName { get; private set; }

        /// <summary>
        /// Site url
        /// </summary>
        public string ConnectionString { get; set; }

        /// <summary>
        /// Properties mapping
        /// </summary>
        public Dictionary<string, PropertyMapping> PropertiesMapping { get; private set; }
    }
}

